package com.ruyuan.payment.pay.controller.admin;

import com.ruyuan.payment.server.req.OrderPayRefundQueryReq;
import com.ruyuan.payment.server.resp.CommonResp;
import com.ruyuan.payment.server.resp.OrderPayRefundQueryResp;
import com.ruyuan.payment.server.resp.PageResp;
import com.ruyuan.payment.server.service.OrderPayRefundService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("/admin/order-pay-refund")
public class AdminOrderPayRefundController {

    @Resource
    private OrderPayRefundService orderPayRefundService;

    @GetMapping("/query-list")
    public CommonResp queryList(@Valid OrderPayRefundQueryReq req) {
        CommonResp<PageResp<OrderPayRefundQueryResp>> commonResp = new CommonResp<>();
        PageResp<OrderPayRefundQueryResp> list = orderPayRefundService.queryList(req);
        commonResp.setContent(list);
        return commonResp;
    }

    @GetMapping("/query-channel/{refundNo}")
    public CommonResp queryChannel(@PathVariable String refundNo) {
        CommonResp<String> commonResp = new CommonResp<>();
        String message = orderPayRefundService.queryChannel(refundNo);
        commonResp.setContent(message);
        return commonResp;
    }

}
